var app = getApp(),
  a = app.requirejs("core");
Page({
  data: {},
  onLoad: function (options) {
    this.setData({
      id: options.id
    });
    this.getInfo();
  },
  getInfo: function () {
    var that = this;
    a.get('User/user_card_info', {
      id: that.data.id
    }, function (t) {
      if (t.code == 0) {
        that.setData({
          info: t.info,
          show:true
        })
        if(t.info.status==1){
          a.get('User/getcardcode', {
            mch_id: t.info.mch_id,
            ucard_id: t.info.id
          }, function (i) {
            that.setData({
              image_url: i
            })
          })
        }
       
      } else {
        a.alert(t.msg);
      }
    }, true)

  },
  phone: function (e) {
    a.phone(e)
  },
  address: function () {
    var data = this.data.info;
    console.log(data)
    if (data.longitude && data.latitude) {
      a.tx_map(data.latitude, data.longitude, data.name);
    }
  },
  img_big: function () {
    if (this.data.image_url) {
      a.previewImage(this.data.image_url)
    }
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    this.getInfo();
    wx.stopPullDownRefresh();
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})